package com.ydd.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.ydd.dto.YddLinkQueryDTO;
import com.ydd.entity.YddLink;
import com.ydd.vo.YddLinkVO;
import org.apache.ibatis.annotations.*;

@Mapper
public interface YddLinkMapper extends BaseMapper<YddLink> {

    @Select("select * from ydd_link where id = #{id};")
    YddLinkVO getRowInfoById(Integer id);

    @Select("select * from ydd_link order by id desc ")
    Page<YddLinkVO> listAll(YddLinkQueryDTO yddLinkQueryDTO);

    @Insert("insert into ydd_link values" +
            "(null,#{title},#{url},#{des},#{img},#{type},#{defaultData});")
    void add(YddLink yddLink);

    @Delete("delete from ydd_link where id = #{id};")
    void deleteById(Integer id);

    int updateById(YddLink yddLink);
}
